<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class BoxTakeOrderResource extends JsonResource
{
    public function toArray($request)
    {
    	$resource = $this->resource;
        $data = [
        	
        	'id' => $resource->id,
        	'is_taken' => (bool)$resource->is_taken,
        	'is_refresh' => (bool)$resource->is_refresh,
        	'product_name' => $resource->product->title ?? '',
        	'paid_at' => $resource->paid_at ?? '',
            'level_name' => $resource->level->name ?? '',
            'address_id'=> $resource->address_id,
            'user' =>new UserResource($resource->user)
	        
        ];
        
        return $data;
    }
}
